home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / pyshared / computerjanitor / missing_package_cruft.py < prev    next >
Encoding:
Python Source  |  2009-04-27  |  1.4 KB  |  46 lines

  1. # missing_package_cruft.py - install a missing package
  2. # Copyright (C) 2009  Canonical, Ltd.
  3. #
  4. # This program is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation, version 3 of the License.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program.  If not, see <http://www.gnu.org/licenses/>.
  15.  
  16.  
  17. import computerjanitor
  18. _ = computerjanitor.setup_gettext()
  19.  
  20.  
  21. class MissingPackageCruft(computerjanitor.Cruft):
  22.  
  23.     """Install a missing package."""
  24.         
  25.     def __init__(self, package, description=None):
  26.         self.package = package
  27.         self.description = description
  28.         
  29.     def get_prefix(self):
  30.         return "install-deb"
  31.         
  32.     def get_prefix_description(self):
  33.         return _("Install missing package.")
  34.         
  35.     def get_shortname(self):
  36.         return self.package.name
  37.         
  38.     def get_description(self):
  39.         if self.description:    
  40.             return self.description
  41.         else:
  42.             return _("Package %s should be installed.") % self.package.name
  43.                 
  44.     def cleanup(self):
  45.         self.package.markInstall()
  46.